﻿@model IEnumerable<SportsStore.Domain.Enities.Product>

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}

<h2>Index</h2>

<table class="table">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.Name)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Description)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Price)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Category)
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Description)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Price)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Category)
        </td>
        <td>
            @Html.ActionLink("编辑", "Edit", new { productId = item.ProductID }, new { @class = "btn btn-default" })
            @using (Html.BeginForm("Delete", "Admin")) { @Html.Hidden("productId",item.ProductID) <input type="submit" value="删除" class="btn btn-default"/>}
            
        </td>
    </tr>
}

</table>

<p>
    @Html.ActionLink("添加一个新商品", "Create")
</p>